use utf-16 string literals with [QDateTime,QDate,QTime]::toString format parameters.
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Mon, 11 Jul 2022 18:01:00 +0000 (12:01 -0600)
committertsteven4 <13596209+tsteven4@users.noreply.github.com>
Mon, 11 Jul 2022 20:50:21 +0000 (14:50 -0600)
dg-100.cc
exif.cc
gpssim.cc
kml.cc
lowranceusr.cc
magproto.cc
nmea.cc
subrip.cc
trackfilter.cc
unicsv.cc
xcsv.cc

index a1f31045fb6646b709c2645b91128ba62f21f806..924fdc0fbf017f9cedf77a84a719284d14e6307c 100644 (file)
--- a/dg-100.cc
+++ b/dg-100.cc
@@ -201,7 +201,7 @@ Dg100Format::process_gpsfile(uint8_t data[], route_head** track) const
       int bintime = be_read32(data + i +  8) & 0x7FFFFFFF;
       int bindate = be_read32(data + i + 12);
       QDateTime creation_time = bintime2utc(bindate, bintime);
-      QString datetime = creation_time.toString("yyyy/MM/dd hh:mm:ss");
+      QString datetime = creation_time.toString(u"yyyy/MM/dd hh:mm:ss");
       *track = new route_head;
       (*track)->rte_name = QStringLiteral("%1 tracklog (%2)").arg(model->name, datetime);
       (*track)->rte_desc = "GPS tracklog data";
diff --git a/exif.cc b/exif.cc
index b6679aab7ae2fe0e8094c1f0632fe4cde733b717..78c605f0a6d5558d125656d4d33bf682a58a3b74 100644 (file)
--- a/exif.cc
+++ b/exif.cc
@@ -194,10 +194,10 @@ ExifFormat::exif_type_size(const uint16_t type)
 QString
 ExifFormat::exif_time_str(const QDateTime& time)
 {
-  QString str = time.toString("yyyy/MM/dd hh:mm:ss t");
+  QString str = time.toString(u"yyyy/MM/dd hh:mm:ss t");
   if (time.timeSpec() != Qt::UTC) {
     str.append(" (");
-    str.append(time.toUTC().toString("yyyy/MM/dd hh:mm:ss t"));
+    str.append(time.toUTC().toString(u"yyyy/MM/dd hh:mm:ss t"));
     str.append(")");
   }
   return str;
@@ -1554,7 +1554,7 @@ ExifFormat::write()
       exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 1, dt.time().minute());
       exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 2, dt.time().second());
 
-      exif_put_str(GPS_IFD, GPS_IFD_TAG_DATESTAMP, CSTR(dt.toString("yyyy:MM:dd")));
+      exif_put_str(GPS_IFD, GPS_IFD_TAG_DATESTAMP, CSTR(dt.toString(u"yyyy:MM:dd")));
     } else {
       exif_remove_tag(GPS_IFD, GPS_IFD_TAG_TIMESTAMP);
       exif_remove_tag(GPS_IFD, GPS_IFD_TAG_DATESTAMP);
index c71f4158a8d7fe8d397d33d1d50ff8c3831fc071..138dc139b8fc5a3e263350170b77d6be51f05a88 100644 (file)
--- a/gpssim.cc
+++ b/gpssim.cc
@@ -125,8 +125,8 @@ gpssim_write_pt(const Waypoint* wpt)
   if (wpt->creation_time.isValid()) {
     char tbuf[20];
 
-    QByteArray dmy = wpt->GetCreationTime().toUTC().toString("ddMMyy").toUtf8();
-    QByteArray hms = wpt->GetCreationTime().toUTC().toString("hhmmss").toUtf8();
+    QByteArray dmy = wpt->GetCreationTime().toUTC().toString(u"ddMMyy").toUtf8();
+    QByteArray hms = wpt->GetCreationTime().toUTC().toString(u"hhmmss").toUtf8();
 
     snprintf(tbuf, sizeof(tbuf), ",%s,%s",dmy.constData(), hms.constData());
     strcat(obuf, tbuf);
diff --git a/kml.cc b/kml.cc
index 3abbbd4b654eabfc2e4460cacc3cad5ac95e5e5f..fbb5b04ca632dcd359c5e4c53e92a2a3af20de0d 100644 (file)
--- a/kml.cc
+++ b/kml.cc
@@ -1301,7 +1301,7 @@ void KmlFormat::kml_geocache_pr(const Waypoint* waypointp) const
   kml_output_timestamp(waypointp);
   QString date_placed;
   if (waypointp->GetCreationTime().isValid()) {
-    date_placed = waypointp->GetCreationTime().toString("dd-MMM-yyyy");
+    date_placed = waypointp->GetCreationTime().toString(u"dd-MMM-yyyy");
   }
 
   writer->writeTextElement(QStringLiteral("styleUrl"), QStringLiteral("#geocache"));
index 85b6f4c78b34c648013ce49b971c22c0a4d027ae..03cb3844296b01e2390d11d4e363d9825eb3e24f 100644 (file)
@@ -468,10 +468,10 @@ LowranceusrFormat::lowranceusr_parse_waypt(Waypoint* wpt_tmp, int object_num_pre
 
   if (global_opts.debug_level > 2) {
     if (global_opts.debug_level == 99) {
-      printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString("yyyy/MM/dd hh:mm:ss")));
+      printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString(u"yyyy/MM/dd hh:mm:ss")));
     } else {
       printf(MYNAME " parse_waypt: creation time '%s', waypt_time %" PRId64 "\n",
-             qPrintable(wpt_tmp->GetCreationTime().toString("yyyy/MM/dd hh:mm:ss")), waypt_time);
+             qPrintable(wpt_tmp->GetCreationTime().toString(u"yyyy/MM/dd hh:mm:ss")), waypt_time);
     }
   }
 
@@ -626,7 +626,7 @@ LowranceusrFormat::lowranceusr4_parse_waypt(Waypoint* wpt_tmp) const
       } else {
         printf(" %6s %16s", QByteArray::number(desc.length()).constData(), qPrintable(desc));
       }
-      printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString("yyyy/MM/dd hh:mm:ss")));
+      printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString(u"yyyy/MM/dd hh:mm:ss")));
       printf(" %08x %8.3f %08x %08x %08x\n",
              unused_byte, fsdata->depth, loran_GRI, loran_Tda, loran_Tdb);
     } else {
@@ -1064,7 +1064,7 @@ LowranceusrFormat::lowranceusr4_parse_trail(int* trail_num) const
   int create_time = gbfgetint32(file_in);
   if (global_opts.debug_level == 99) {
     QDateTime qdt = lowranceusr4_get_timestamp(create_date, create_time);
-    printf(MYNAME " parse_trails: creation date/time = %s\n", qPrintable(qdt.toString("yyyy-MM-dd hh:mm:ss AP")));
+    printf(MYNAME " parse_trails: creation date/time = %s\n", qPrintable(qdt.toString(u"yyyy-MM-dd hh:mm:ss AP")));
   }
 
   /* Some flag bytes */
@@ -1129,7 +1129,7 @@ LowranceusrFormat::lowranceusr4_parse_trail(int* trail_num) const
     if (global_opts.debug_level >= 2) {
       if (global_opts.debug_level == 99) {
         printf(MYNAME " parse_trails: %+14.9f %+14.9f", wpt_tmp->longitude, wpt_tmp->latitude);
-        printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString("yyyy/MM/dd hh:mm:ss")));
+        printf(" '%s'", qPrintable(wpt_tmp->GetCreationTime().toString(u"yyyy/MM/dd hh:mm:ss")));
       } else {
         printf(MYNAME " parse_trails: added trailpoint %+.9f,%+.9f to trail %s\n",
                wpt_tmp->longitude, wpt_tmp->latitude, qPrintable(trk_head->rte_name));
@@ -1224,7 +1224,7 @@ LowranceusrFormat::read()
     int create_time = gbfgetint32(file_in);
     if (global_opts.debug_level >= 1) {
       QDateTime qdt = lowranceusr4_get_timestamp(create_date, create_time);
-      printf(MYNAME " creation date/time : '%s'\n", qPrintable(qdt.toString("yyyy-MM-dd hh:mm:ss AP")));
+      printf(MYNAME " creation date/time : '%s'\n", qPrintable(qdt.toString(u"yyyy-MM-dd hh:mm:ss AP")));
     }
 
     unsigned char byte = gbfgetc(file_in); /* unused, apparently */
@@ -1334,7 +1334,7 @@ LowranceusrFormat::lowranceusr_waypt_disp(const Waypoint* wpt) const
     /* Lowrance needs it as seconds since Jan 1, 2000 */
     waypt_time -= base_time_secs;
     if (global_opts.debug_level >= 2) {
-      printf("creation_time %" PRId64 ", '%s'", waypt_time, qPrintable(wpt->GetCreationTime().toString("yyyy-MM-dd hh:mm:ss")));
+      printf("creation_time %" PRId64 ", '%s'", waypt_time, qPrintable(wpt->GetCreationTime().toString(u"yyyy-MM-dd hh:mm:ss")));
     }
   } else {
     /* If false, make sure it is an unknown time value */
@@ -1880,7 +1880,7 @@ LowranceusrFormat::write()
 
     /* date string */
     gpsbabel::DateTime now = current_time().toUTC();
-    lowranceusr4_writestr(now.toString("MM/dd/yyyy"), file_out, 1);
+    lowranceusr4_writestr(now.toString(u"MM/dd/yyyy"), file_out, 1);
 
     /* creation date/time */
     auto ts = lowranceusr4_jd_from_timestamp(now);
index 521ab9339881c485ba3ff504b521f83e9d7c0655..e5a278f29b7802a1d4b6b47335375ad121a7e7dc 100644 (file)
@@ -1422,8 +1422,8 @@ void mag_track_disp(const Waypoint* waypointp)
     QDateTime dt = waypointp->GetCreationTime().toUTC();
     dt = dt.addMSecs(10 * lround(dt.time().msec()/10.0) - dt.time().msec());
     assert((dt.time().msec() % 10) == 0);
-    dmy = dt.toString("ddMMyy").toUtf8();
-    hms = dt.toString("hhmmss.zzz").left(9).toUtf8();
+    dmy = dt.toString(u"ddMMyy").toUtf8();
+    hms = dt.toString(u"hhmmss.zzz").left(9).toUtf8();
   }
 
   double lon = fabs(ilon);
diff --git a/nmea.cc b/nmea.cc
index 8a3c9279526114b439b6034c7960ab302d4773d4..566c5ecfea77269dc440229822201e52ed0306cc 100644 (file)
--- a/nmea.cc
+++ b/nmea.cc
@@ -1222,8 +1222,8 @@ NmeaFormat::nmea_trackpt_pr(const Waypoint* wpt)
   QByteArray dmy("");
   QByteArray hms("");
   if (wpt->GetCreationTime().isValid()) {
-    dmy = wpt->GetCreationTime().toUTC().toString("ddMMyy").toUtf8();
-    hms = wpt->GetCreationTime().toUTC().toString("hhmmss.zzz").toUtf8();
+    dmy = wpt->GetCreationTime().toUTC().toString(u"ddMMyy").toUtf8();
+    hms = wpt->GetCreationTime().toUTC().toString(u"hhmmss.zzz").toUtf8();
   }
 
   switch (wpt->fix) {
index 6bcb1c7d010d62e55e55dbbf069015f75b681040..6b5757d81ac7db862e91bf31b0a72e59f9edf10e 100644 (file)
--- a/subrip.cc
+++ b/subrip.cc
@@ -180,7 +180,7 @@ SubripFormat::subrip_trkpt_pr(const Waypoint* waypointp)
       qDebug().noquote() << "GPS track start is           "
                          << waypointp->GetCreationTime().toUTC().toString(Qt::ISODateWithMs);
       qDebug().noquote() << "Synchronizing"
-                         << video_time(gps_datetime).toString("HH:mm:ss,zzz")
+                         << video_time(gps_datetime).toString(u"HH:mm:ss,zzz")
                          << "to" << gps_datetime.toString(Qt::ISODateWithMs);
       qDebug().noquote() << "Video start   00:00:00,000 is"
                          << video_datetime.toString(Qt::ISODateWithMs);
index a1a435f240fac0d1d76a22890fde4d154b6d9f11..0163ca5b218e223a74bfb7f5980053b619da7f41 100644 (file)
@@ -238,9 +238,9 @@ void TrackFilter::trackfilter_split_init_rte_name(route_head* track, const gpsba
   QString datetimestring;
 
   if (opt_interval != 0) {
-    datetimestring = dt.toUTC().toString("yyyyMMddhhmmss");
+    datetimestring = dt.toUTC().toString(u"yyyyMMddhhmmss");
   } else {
-    datetimestring = dt.toUTC().toString("yyyyMMdd");
+    datetimestring = dt.toUTC().toString(u"yyyyMMdd");
   }
 
   if ((opt_title != nullptr) && (strlen(opt_title) > 0)) {
index acfd05001486e1687f002f1e691d3d54eec02fe7..6788f6dacbcda1b13fec6cf8c8e4668e79ff76cd 100644 (file)
--- a/unicsv.cc
+++ b/unicsv.cc
@@ -1147,7 +1147,7 @@ UnicsvFormat::unicsv_print_data_time(const QDateTime& idt) const
     dt = dt.toUTC();
   }
 
-  unicsv_print_str(dt.toString("yyyy/MM/dd hh:mm:ss"));
+  unicsv_print_str(dt.toString(u"yyyy/MM/dd hh:mm:ss"));
 }
 
 #define FIELD_USED(a) (gb_getbit(&unicsv_outp_flags, a))
@@ -1547,7 +1547,7 @@ UnicsvFormat::unicsv_waypt_disp_cb(const Waypoint* wpt)
       } else {
         dt = wpt->GetCreationTime().toLocalTime();
       }
-      QString date = dt.toString("yyyy/MM/dd");
+      QString date = dt.toString(u"yyyy/MM/dd");
       *fout << unicsv_fieldsep << date;
     } else {
       *fout << unicsv_fieldsep;
@@ -1564,9 +1564,9 @@ UnicsvFormat::unicsv_waypt_disp_cb(const Waypoint* wpt)
       }
       QString out;
       if (t.msec() > 0) {
-        out = t.toString("hh:mm:ss.zzz");
+        out = t.toString(u"hh:mm:ss.zzz");
       } else {
-        out = t.toString("hh:mm:ss");
+        out = t.toString(u"hh:mm:ss");
       }
       *fout << unicsv_fieldsep << out;
     } else {
diff --git a/xcsv.cc b/xcsv.cc
index 9d9af116bd7277715f3b684263ba0bee4e6e1407..8adc85cb944b69b7aaba188c9da1a187a4486fe7 100644 (file)
--- a/xcsv.cc
+++ b/xcsv.cc
@@ -1590,13 +1590,13 @@ XcsvFormat::xcsv_replace_tokens(const QString& original) const
 
     QDateTime dt = current_time().toUTC();
 
-    QString dts = dt.toString("ddd MMM dd hh:mm:ss yyyy");
+    QString dts = dt.toString(u"ddd MMM dd hh:mm:ss yyyy");
     replacement.replace("__DATE_AND_TIME__", dts);
 
-    QString d = dt.toString("MM/dd/yyyy");
+    QString d = dt.toString(u"MM/dd/yyyy");
     replacement.replace("__DATE__", d);
 
-    QString t = dt.toString("hh:mm:ss");
+    QString t = dt.toString(u"hh:mm:ss");
     replacement.replace("__TIME__", t);
   }
   return replacement;